<?php
// +----------------------------------------------------------------------
// | Quotes [ 只为给用户更好的体验]**[我知道发出来有人会盗用,但请您留版权]
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 青涩  <3489621943@qq.com>          盗用不留版权,你就不配拿去!
// +----------------------------------------------------------------------
// | Date: 2021年03月24日
// +----------------------------------------------------------------------

include("../includes/common.php");
if(isset($_POST['user']) && isset($_POST['pass'])){
	$user=daddslashes($_POST['user']);
	$pass=daddslashes($_POST['pass']);
	if($user==$conf['admin_user'] && $pass==$conf['admin_pwd']) {
		$session=md5($user.$pass.$password_hash);
		$token=authcode("{$user}\t{$session}", 'ENCODE', SYS_KEY);
		setcookie("admin_token", $token, time() + 604800, null, null, null, true);
		@header('Content-Type: text/html; charset=UTF-8');
		exit("<script language='javascript'>alert('登陆后台管理成功！');window.location.href='./';</script>");
	}elseif ($pass != $conf['admin_pwd']) {
		@header('Content-Type: text/html; charset=UTF-8');
		exit("<script language='javascript'>alert('用户名或密码不正确！');history.go(-1);</script>");
	}
}elseif(isset($_GET['logout'])){
	setcookie("admin_token", "", time() - 604800);
	@header('Content-Type: text/html; charset=UTF-8');
	exit("<script language='javascript'>alert('您已成功注销本次登陆！');window.location.href='./login.php';</script>");
}elseif($islogin==1){
	exit("<script language='javascript'>alert('您已登陆！');window.location.href='./';</script>");
}
$title='用户登录';
?> 
  <!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>登录页面 - <?php echo $conf['name']?>后台管理系统模板</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="<?php echo $conf['name']?>,惜语">
<meta name="description" content="<?php echo $conf['name']?>是惜语旗下的社会化账号聚合登录系统，让网站的最终用户可以一站式选择使用QQ帐号登录该站点">
<meta name="author" content="yinqi">
<link href="../css/bootstrap.min.css" rel="stylesheet">
<link href="../css/materialdesignicons.min.css" rel="stylesheet">
<link href="../css/style.min.css" rel="stylesheet">
<style type="text/css">
    *{margin: 0;padding: 0}
    html,body{height: 100%}

    .outer-wrap{
 		height: 100%;
		position: relative;
		background-color: rgba(0,0,0, .5);
		}	
    .login-panel{
		width: 400px;
		height: 300px;
		background-color: orange
		position:absolute;
		top: 50%;
		left: 50%
		margin-top: -150px;
		margin-left: -200px;
		}
</style>
</head>
<body class="center-vh" style="background-image: url(../assets/images/login-bg-3.jpg); background-size: cover;">
<div id="loginPanel" style="position:absolute; top:50%; left:50%; width:480px; height:240px; margin-left:-240px; margin-top:-120px;">
 <div class="bg-translucent p-2">
  <div class="flex-box bg-white login-box">
    <div class="login-left p-5">
      
      <div class="text-center mb-3 d-sm-none">
         <img alt="light year admin" src="../assets/images/logo-sidebar.png"></i> </a>
      </div>
      <form action="./login.php" method="post" class="login-form">
        <div class="form-group has-feedback">
          <span class="mdi mdi-account" aria-hidden="true"></span>
          <input type="text" class="form-control" name="user" placeholder="用户名" required="required"/>
        </div>
    
        <div class="form-group has-feedback">
          <span class="mdi mdi-lock" aria-hidden="true"></span>
          <input type="password" class="form-control" name="pass" placeholder="密码" required="required"/>
        </div>
        
        <div class="form-group">
          <div class="custom-control custom-checkbox">
            <input type="checkbox" class="custom-control-input" name="rememberme">
            <label class="custom-control-label not-user-select" for="rememberme">5天内自动登录</label>
          </div>
        </div>
    
        <div class="form-group">
          <button class="btn btn-block btn-primary" type="submit">立即登录</button>
        </div>
      </form>
    </div>
    <div class="login-right p-5 d-none d-sm-block">
    </div>
  </div>
</div>
</div>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript">;</script>
</body>
      
</html>